Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap: delay the instantiation of maps in per-context scripts #27371

Closed
wants to merge 1 commit into from

Conversation

joyeecheung
Copy link
Member

Instantiating maps renders the snapshot non-rehashable
(v8 currently fails silently during CreateBlob()).
Then the hash seed would always be the same and not
recomputed if custom V8 snapshot is enabled. This patch
delays the instantiation of the maps in domexception.js
and make it lazy.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Instantiating maps renders the snapshot non-rehashable
(v8 currently fails silently during `CreateBlob()`).
Then the hash seed would always be the same and not
recomputed if custom V8 snapshot is enabled. This patch
delays the instantiation of the maps in domexception.js
and make it lazy.
@nodejs-github-bot
Copy link
Collaborator

@joyeecheung
Copy link
Member Author

joyeecheung commented Apr 23, 2019

pummel/test-hash-seed with ./configure --with-node-snapshot: https://ci.nodejs.org/job/node-test-commit-custom-suites-freestyle/6429/

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM … do you know how much work would be necessary to support this in V8?

@joyeecheung
Copy link
Member Author

joyeecheung commented Apr 23, 2019

@addaleax Should be pretty easy to return the status back, I'll submit a proposed API change in the upstream. I am not entirely sure if it actually make sense to return this status back though - at least judging from the TODOs in V8, the plan is to make the status always true and obsolete in the future, but I guess it does not hurt much to have an always true return value either, and it seems to take quite some effort to make everything rehashable so that probably won't happen anytime soon.

EDIT: also if you are asking about how much work it would take to support rehashing these types in V8...I don't actually know? But it seems nontrivial. (I guess only @hashseed knows ;)

@joyeecheung
Copy link
Member Author

joyeecheung commented Apr 23, 2019

I also uploaded https://chromium-review.googlesource.com/c/v8/v8/+/1578661 but I guess something like that won't happen very soon.

@nodejs-github-bot
Copy link
Collaborator

@refack
Copy link
Contributor

refack commented Apr 24, 2019

v8 currently fails silently during CreateBlob()

Can we add an explicit fail so the code doesn't revert?

@refack refack added lib / src Issues and PRs related to general changes in the lib or src directory. process Issues and PRs related to the process subsystem. v8 engine Issues and PRs related to the V8 dependency. labels Apr 24, 2019
@joyeecheung
Copy link
Member Author

joyeecheung commented Apr 24, 2019

Can we add an explicit fail so the code doesn't revert?

@refack There is no way for us to check this yet (that's why there is https://chromium-review.googlesource.com/c/v8/v8/+/1578661, or at least until https://bugs.chromium.org/p/v8/issues/detail?id=6593 is fixed). Among other things, you'd need to traverse the heap to find types that use the hash seed and as an embedder there's no API for us to do that.

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 24, 2019
@danbev
Copy link
Contributor

danbev commented Apr 26, 2019

Landed in 08a9c4a.

@danbev danbev closed this Apr 26, 2019
danbev pushed a commit that referenced this pull request Apr 26, 2019
Instantiating maps renders the snapshot non-rehashable
(v8 currently fails silently during `CreateBlob()`).
Then the hash seed would always be the same and not
recomputed if custom V8 snapshot is enabled. This patch
delays the instantiation of the maps in domexception.js
and make it lazy.

PR-URL: #27371
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
targos pushed a commit that referenced this pull request Apr 27, 2019
Instantiating maps renders the snapshot non-rehashable
(v8 currently fails silently during `CreateBlob()`).
Then the hash seed would always be the same and not
recomputed if custom V8 snapshot is enabled. This patch
delays the instantiation of the maps in domexception.js
and make it lazy.

PR-URL: #27371
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@targos targos mentioned this pull request Apr 27, 2019
@hashseed
Copy link
Member

I filed an issue for rehashing Map/Set: https://bugs.chromium.org/p/v8/issues/detail?id=9187

I think it's non-trivial to do in-place, but inserting into a new backing store might be doable and good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. lib / src Issues and PRs related to general changes in the lib or src directory. process Issues and PRs related to the process subsystem. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants